<template>
	<view class="StationPay_div">
		
		<view :class="['vh90',{'dark':theme == 'dark'}]">
			
			<view class="StationPay">
				<u-field
					v-model="name" :border-bottom="false" label-width="150" :clearable="false" :label="$t('bico.W706')+ ':'"  :placeholder="$t('bico.W703')">
				</u-field>
				<u-line color="#5559691f"></u-line>
				<!-- <u-field
					v-model="jiner" :border-bottom="false" label-width="150" clearable="false" :label="$t('boco.W696')+codeText[anType]+' :'" :placeholder="$t('boco.W696')+codeText[anType]">
				<u-button size="mini" slot="right" type="info" @click="change">{{codeText[anType]}}</u-button>
				</u-field> --> 
				
				
				<u-field 
					v-model="jiner" :border-bottom="false" label-width="150" :clearable="false" :label="$t('bico.W705')+' '+codeText[anType]+' :'" :placeholder="$t('bico.W702')+codeText[anType]">
				<u-button size="mini" slot="right" type="info" @click="change">{{codeText[anType]}}</u-button>
				</u-field> 
				<u-line color="#5559691f"></u-line>
				<u-field
					v-model="zijinmima" :border-bottom="false" label-width="150" :clearable="false" :label="$t('recharge.asset') +':'" :placeholder="$t('recharge.assetEmpty')">
				</u-field>
				<u-line color="#5559691f"></u-line>
				<!-- <u-field
					v-model="code" :border-bottom="false" label-width="150" label="验证信息 :" placeholder="请输入验证码">
				<u-button size="mini" slot="right" type="success" @click="getCode">{{codeText}}</u-button>
				</u-field>
				<u-line color="#5559691f"></u-line>
				<u-verification-code ref="uCode" @change="codeChange"></u-verification-code> -->
				<view style="width: 100%;padding: 20rpx 30rpx;">
					<view style="width: 90%;text-align: left;position: fixed; ">
						{{$t("bico.W368")}}：{{price}}USDT
					</view>
					<view style="width: 90%;text-align: right;position: fixed;">
						1USDT ≈ {{cnyPrice}}CNY
					</view>
				</view>
				<u-button  size="default" type="primary" @click="submit">{{$t('bico.W701')}}</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	import {domain} from '@/common/domain.js'
	import {mapState,mapActions,mapGetters} from 'vuex';
	import uniPopup from '@/components/uni-popup2.vue';
	import {myMixins} from '@/common/myMixins.js'
	import {transferPage,transfer } from '../../common/apiString.js'
	export default {
		mixins:[myMixins],
		data() {
			return {
				name: '',
				jiner: '',
				price:0,
				cnyPrice:0,
				zijinmima: '',
				code: '',
				anType:0,
				codeText: [this.$t('bico.W699'),this.$t('bico.W700')]
				
			}
		},
		components: {
			
		},
		computed:{
			...mapState({
			  theme:state=>state.theme
			}),
		},
		onLoad() {
			uni.setNavigationBarTitle({
				title:this.$t('login').c6
			})
			this.$utils.setTheme(this.theme);
			this.getData()
		},
		methods: {
			change() {
				if(this.anType==1){
					this.anType=0
				}else{
					this.anType=1
				}
			},
			// getCode() {
			// 	if(this.$refs.uCode.canGetCode) {
			// 		// 模拟向后端请求验证码
			// 		uni.showLoading({
			// 		title: '正在获取验证码'
			// 		})
			// 	setTimeout(() => {
			// 		uni.hideLoading();
			// 			// 通知验证码组件内部开始倒计时
			// 		this.$refs.uCode.start();
			// 	}, 2000);
			// 	}else {
			// 	this.$u.toast('倒计时结束后再发送');
			// }
		 //    },
			getData(){
				var that = this;
				this.$utils.initDataToken({url:transferPage,type:'post'},(res,msg)=>{
					var obj = res;
					that.price = Number(obj.price).toFixed(2);
					that.cnyPrice = Number(obj.usdt).toFixed(2);
				})
			},
			submit(){
				var that = this
				if(that.$utils.isEmpty(that.name)){
					this.$u.toast(this.$t('bico.W148'),);
					return false
				}
				if(that.$utils.isEmpty(that.jiner)){
					this.$u.toast(this.$t('bico.W26'),);
					return false
				}
				if(that.$utils.isEmpty(that.zijinmima)){
					this.$u.toast(this.$t('bico.W210'),);
					return false
				}
				
				var dataArr = {}
				dataArr.account=this.name
				dataArr.price = this.jiner
				dataArr.type=this.anType==0?'USDT':'CNY'
				dataArr.payPwd = this.zijinmima
				this.$utils.initDataToken({url:transfer,data:dataArr,type:'post'},(res,msg)=>{
					this.$utils.showLayer(this.$t('codeTxt.trasferSuccess'));
					this.getData()
				})
			}
		}
	}
</script>
<style scoped>
.StationPay_div{
	

	
}
.StationPay{
	

	
}
.u-size-default{
    white-space: normal;
    width: 90vw;
    height: 46px;
    padding: 0px;
    clear: both;
    margin-top: 31px;
    margin-left: 5vw;
    float: left;
    background-color: #007aff;
    text-align: center;
    justify-content: center;
    border-radius: 5px;
    cursor: pointer;
    color: #ffffff;
    font-size: 13px;
    line-height: 46px;
}

.u-field {
    font-size: 14px;
    padding: 20px 14px;
    text-align: left;
    position: relative;
    color: #303133;
}

</style>
